#pragma once

#include "Core/Shared/Interfaces/IRenderingDevice.h"
#include "Core/Shared/RenderedFrame.h"
#include "Core/Shared/Video/VideoRenderer.h"
#include "Utilities/SimpleLock.h"

#include <QImage>
#include <QObject>

class Emulator;

class QRender : public QObject, public IRenderingDevice
{
    Q_OBJECT
public:
    QRender(Emulator *emu);
    ~QRender() override;

    void UpdateFrame(RenderedFrame &frame) override;
    void ClearFrame() override;
    void Render(RenderSurfaceInfo &emuHud, RenderSurfaceInfo &scriptHud) override;
    void Reset() override;
    void OnRendererThreadStarted() override;
    void SetExclusiveFullscreenMode(bool fullscreen, void *windowHandle) override;

Q_SIGNALS:
    void frameUpdated(const QImage &frameImage);

private:
    Emulator *m_emulator = nullptr;
    uint32_t m_requredWidth;
    uint32_t m_requredHeight;
    QImage m_frameImage;
};
